//
//  FightingLayer.h
//  DiceWar
//
//  Created by xiaofeng on 27/6/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#ifndef CLASSES_GAME_GAMEPLAY_HEXMAP_FIGHTINGLAYER_H_
#define CLASSES_GAME_GAMEPLAY_HEXMAP_FIGHTINGLAYER_H_

#include "cocos2d.h"
#include "HexCellCoordinate.h"

class FightingLayer : public cocos2d::CCLayer
{
public:
    LAYER_NODE_FUNC(FightingLayer);
    bool init();
    
    void setAttacker(int coordinateX, int coordinateY);
    void setDefender(int coordinateX, int coordinateY);
    
    bool isNextToAttacker(int coordinateX, int coordinateY);
    bool isNextToDefender(int coordinateX, int coordinateY);
    
    void unsetAttacker();
    void unsetDefender();
    
    int getAttackerPower();
    int getDefenderPower();
    
private:
    int getPower(int numDices);
    
    void showAttacker(cocos2d::CCPoint position);
    void hideAttacker();
    
    void showDefender(cocos2d::CCPoint position);
    void hideDefender();
    
    cocos2d::CCSprite* createSelectionSprite();
    
private:
    cocos2d::CCSprite* m_pAttackerSprite;
    cocos2d::CCSprite* m_pDefenderSprite;
    HexCellCoordinate m_attackerCoordinate;
    HexCellCoordinate m_defenderCoordinate;
};


#endif //CLASSES_GAME_GAMEPLAY_HEXMAP_FIGHTINGLAYER_H_
